<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@page contentType="text/html; charset=UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>sino</title>
	<!-- easyUI -->
	<link rel="stylesheet" type="text/css" href="<s:url value='js/easyUI/themes/default/easyui.css'></s:url>" />
	<link rel="stylesheet" type="text/css" href="<s:url value='js/easyUI/themes/icon.css'></s:url>" />
	
	<link rel="stylesheet" type="text/css" href="<s:url value='js/kindEditor/css/default.css'></s:url>" />

	<link rel="stylesheet" type="text/css" href="<s:url value='common/css/common.css'></s:url>" />
	
	<!-- jquery part -->
	<script type="text/javascript" src="<s:url value='js/easyUI/jquery.js'></s:url>"></script>
	<script type="text/javascript" src="<s:url value='js/jqueryUI/jqueryUI.js'></s:url>"></script>
	
	<!-- easyUI part -->
	<script type="text/javascript" src="<s:url value='js/easyUI/easyUI.js'></s:url>"></script>
	<script type="text/javascript" src="<s:url value='js/kindEditor/kindeditor.js'></s:url>"></script>
	<script type="text/javascript">
		var contentEditer = null ; 
		var summaryEditer= null ; 
		$(document).ready(function () {
			try{
				//init editers
				contentEditer = KindEditor.create('#articleContent');
				summaryEditer = KindEditor.create('#articleSummary');
				
				//show articles
				$("#indexPage").load('<s:url action="article/article_listTitleInfo" />') ;
			}catch(e){
				alert(e.message) ;
			}
        }); 
		function test(){
			editer.sync() ;
			alert($("#articleUpload").val()) ;
			editer.html("<a href='#'>haha</a>") ;
		}
		function addArticle(){
			contentEditer.sync() ;
			summaryEditer.sync() ;
			try{
				var data = new Object() ;
				data["article.userId"] = "007" ;
				data["article.content"] =  $("#articleContent").val() ;
				data["article.summary"] = $("#articleSummary").val() ;
				data["article.title"] = $("#articleTitle").val() ;
				var strUrl = "<s:url action='/article/article_add'></s:url>" ;
				$.ajax({
					method:"post",
					url:strUrl,
					data:data,
					success:function(msg){
						alert(msg) ;
					}
				}) ;
			}catch(e){alert(e.message) ;}
		}
	</script>
</head>
<body>
	<div class="easyui-tabs center" style="width:900px;height:900px">
		<div id='indexPage' title='首页'>
			首页
		</div>
		<div title='论文'>
			论文
			<a href='<s:url action="article/article_listTitleInfo" />'>aaaaaaaaaaaaaa</a>
		</div>
		<div title='上传文章'>
			<div class=" center noscroll" title="编辑新文章" style="width:800px;"> 
				<form id="ff" method="post">  
				<div class="easyui-panel noscroll" title="Title" style="width:800px"> 
		            <input id='articleTitle' class="easyui-validatebox" type="text" style="width:90%" name="name" data-options="required:true"></input>
				</div>	                      
				<div class="easyui-panel noscroll" title="Summary" style="width:800px"> 
		            <textarea id="articleSummary" style='width:800px;height:300px'></textarea>
				</div>	                      
				<div class="easyui-panel noscroll" title="Content" style="width:800px"> 
		            <textarea id="articleContent" style='width:800px;height:300px'></textarea>
				</div>	                      
		        </form>  
			</div>			
	        <div style="text-align:center;padding:5px">  
	            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="addArticle()">Submit</a>  
	            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">Clear</a>  
	        </div>  
		</div>
	</div>
</body>
</html>